package top.zuli.package01.class04;

public class SortDemo3 {
    public static void main(String[] args) {
        int[] arr = {1,11,9,3,7,5};
        for (int index = 1; index < arr.length; index++) {
            int t = arr[index];
            int leftIndex = index -1;
            while (leftIndex >= 0 && arr[leftIndex]>t){
                arr[leftIndex + 1] = arr[leftIndex];
                leftIndex--;
            }
            arr[leftIndex+1] = t;
        }
        for (int i : arr){
            System.out.print(i+" ");
        }
    }
}
